package com.example.goodpet.activity;

import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentTransaction;
import androidx.viewpager2.widget.ViewPager2;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageButton;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;

import com.example.goodpet.R;
import com.example.goodpet.activity.Fragment.HospitalInfoFragment;
import com.example.goodpet.activity.Fragment.PetTipsFragment;
import com.example.goodpet.home.adapter.HomePagerAdapter;
import com.example.goodpet.home.fragment.HomeFragment;
import com.example.goodpet.home.homeFocus.fragment.HomeFocusFragment;
import com.example.goodpet.home.homeRecommend.fragment.HomeRecommendFragment;
import com.example.goodpet.utils.ActivityManager;
import com.zackratos.ultimatebarx.ultimatebarx.java.UltimateBarX;

import java.util.List;

public class PetTipsActivity extends FragmentActivity {


    private ImageButton back;
    private TextView title;
    private PetTipsFragment fragment;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_pet_tips);
        UltimateBarX.statusBarOnly(this)
                .fitWindow(true)
                .colorRes(R.color.ic_back_background)
                .light(true)
                .apply();
        ActivityManager.getInstance().addActivity(this);
        initView();
        initFragment();
        initListener();
    }

    private void initListener() {
        back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    }

    private void initFragment() {
        fragment=new PetTipsFragment();
        FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
        if(!fragment.isAdded()){
            transaction.add(R.id.fragment,fragment);
            transaction.commit();
        }
    }

    private void initView() {
        back=findViewById(R.id.titlebar_common_back);
        title=findViewById(R.id.titlebar_common_title);
        title.setText("养宠小贴士");

    }

}